﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Yipusoft.Account.BLL;
using Yipusoft.Account.Model;
using Yipusoft.Common.BLL;
using Yipusoft.Common.Model;
using Yipusoft.Task.BLL;
using Yipusoft.Task.Model;
using Yipusoft.Evaluate.BLL;
using Yipusoft.Evaluate.Model;
using System.Text;
using System.Data;

public partial class Evaluate_AllStandard : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Yipusoft.Account.BLL.User.HasPermission(Context.User.Identity.Name, "320601"))
        {
            Response.Write("<script>alert('没有权限！');history.back(0);</script>");
        }
        if (!IsPostBack)
        {
            ActionTitle.Text = "综合评估设置";
            BindData();
        }
    }
    private void BindData()
    {
        StandardInfo standard = Standard.GetStandard();
        TotalScore.Text = standard.TotalScore.ToString();
        TaskPer.Text = standard.TaskPer.ToString();
        BasePer.Text = standard.BasePer.ToString();
        InspectPer.Text = standard.InspectPer.ToString();
        CheckPer.Text = standard.CheckPer.ToString();
    }
    protected void ButtonSave_Click(object sender, EventArgs e)
    {
        try
        {
            StandardInfo standard = Standard.GetStandard();
            standard.TotalScore = decimal.Parse(TotalScore.Text);
            standard.TaskPer = decimal.Parse(TaskPer.Text);
            standard.BasePer = decimal.Parse(BasePer.Text);
            standard.InspectPer = decimal.Parse(InspectPer.Text);
            standard.CheckPer = decimal.Parse(CheckPer.Text);
            if (Standard.Update(standard))
                Prompt.Text = "提示：更新成功！";
            else
                Prompt.Text = "错误：更新失败！";
        }
        catch (Exception ex)
        {
            Prompt.Text = "错误：" + ex.Message;
        }
    }
    protected void ButtonCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("AllReport.aspx");
    }
}
